<template>
  <view class="search-container" :style="{'background-color': bgcolor}">
    <view class="search-box" :style="{borderRadius: radius+'px'}" @click="searchClickHandler">
      <uni-icons type="search" size="18"></uni-icons>
      <text class="search-text">搜索</text>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-search",
    data() {
      return {
        
      };
    },
    props: {
      bgcolor: {
        type: String,
        default: '#c00000'
      },
      radius: {
        type: Number,
        default: 50
      },
    },
    methods: {
      searchClickHandler(e){
        console.log('my-search 被点击了', e)
        this.$emit('click', {xxx: 'xxx'})
      }
    }
  }
</script>

<style lang="scss">
  .search-container {
    height: 50px;
    background-color: #c00000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 32rpx;
    .search-box {
      background-color: #ffffff;
      border-radius: 50px;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
      height: 36px;
      
      .search-text {
        margin-left: 16rpx;
      }
    }
  }
</style>
